import java.awt.*;
import java.awt.event.*;

class PopupColorMenu extends PopupMenu implements ActionListener {
    static Color colors[]={Color.black,Color.green,Color.red};
    static String names[]={"unknouwn","Pro","Con"};
   
    private Selectable selectable;
    PopupColorMenu(Selectable selectable){ 
        super();
	this.selectable=selectable;
        for(int i=0;i<colors.length;i++){
	    MenuItem temp=new MenuItem(names[i]);
	    //temp.setBackground(colors[i]);
	    temp.addActionListener(this);
	    add(temp);
	}
	addActionListener(this);     
    }

    public void actionPerformed(ActionEvent e){
	Color color=Color.black;
	for(int i=0;i<colors.length;i++){
	    if(names[i]==e.getActionCommand()){
		System.out.println(i);
		color=colors[i];
		break;
	    }
	}
	try {
	    selectable.color=color;
	}
	catch(NullPointerException ex){
	    ex.printStackTrace();

	    Selectable.defaultColor=color;
	}
    }
}
